﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using NFinal.Action;

namespace NFinal
{
    public class RedirectResult : ActionResult
    {
        public string Url { get; set; }
        public RedirectResult(string url)
        {
            this.Url = url;
        }
        public override void ExecuteResult<TContext, TRequest>(AbstractAction<TContext, TRequest> context)
        {
            context.SetResponseStatusCode(302);
            context.SetResponseHeader(NFinal.Constant.HeaderContentType, NFinal.Constant.ResponseContentType_Text_html);
            context.SetResponseHeader(NFinal.Constant.HeaderLocation, this.Url);
        }
    }
}
